//
//  HOQuestionTypeViewController.m
//  微度报修
//
//  Created by foguo-mac-1 on 09/05/2017.
//  Copyright © 2017 WeiDu. All rights reserved.
//

#import "HOQuestionTypeViewController.h"
#import "HODefine.h"

@interface HOQuestionTypeViewController ()
{
	
}
@property(nonatomic, retain)NSArray *types;
@end

@implementation HOQuestionTypeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
	[self initData];
	[self initTableView];
	
}

- (void)initData
{
	//0:提议新需求 1:功能不足问题  2:App问题  3:其他问题
	self.types = [NSArray arrayWithObjects:NSLocalizedString(@"提议新需求", @"提议新需求"), NSLocalizedString(@"功能改动", @"功能改动"), NSLocalizedString(@"App问题", @"App问题"), NSLocalizedString(@"其他问题", @"其他问题"), nil];
}

- (void)viewWillAppear:(BOOL)animated
{
	[super viewWillAppear:animated];
	[self setNavigationItemTitle:NSLocalizedString(@"选择问题类型", @"选择问题类型")];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - -- UITableViewDelegate/UITableViewDataResource implement methods
//- (CGFloat) tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
//{
//	return 12;
//}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
	return 44;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
	return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
	return [self.types count];
}


//- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
//{
//	return 12;
//}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
	static NSString *AMBaseTableViewCellIdentifier = @"HOTableViewCell";
	UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:AMBaseTableViewCellIdentifier];
	if(cell == nil)
	{
		cell = [[[UITableViewCell alloc]
				 initWithStyle:UITableViewCellStyleDefault
				 reuseIdentifier: AMBaseTableViewCellIdentifier] autorelease];
		cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
	}
	NSString *type = [self.types objectAtIndex:indexPath.row];
	cell.textLabel.text = type;
	cell.textLabel.font = [UIFont systemFontOfSize:16];
	return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
	[tableView deselectRowAtIndexPath:indexPath animated:YES];
	NSString *type = [self.types objectAtIndex:indexPath.row];
	if(self.delegate && [self.delegate respondsToSelector:@selector(didSelectQuestionType:withTypeContent:)])
		[self.delegate didSelectQuestionType:(HO_QUESTION_TYPE)indexPath.row withTypeContent:type];
	[self goBack];
}
#pragma mark
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
